package com.xy.model;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/*
 * @学生表
 */
@SuppressWarnings("serial")
@Entity
@Table
@Cacheable
public class Student extends Identified implements Serializable {
	@Column(nullable = false,unique = true)
	private String num;// 学号
	@Column(nullable = false)
	private String sname;// 姓名
	@Column(nullable = false)
	private String sex;// 性别
	@Column(nullable = false)
	private String birthday;// 出生日期
	@Column(nullable = false)
	private String nativeplace;// 籍贯
	@Column(nullable = false)
	private String address;// 通信地址
	@Column(nullable = false)
	private String tel;// 联系电话
	private String remark;// 备注

	@OneToMany(targetEntity = BookFee.class, mappedBy = "student") // 学生

	private Set<BookFee> bookFees = new HashSet<BookFee>();

	@ManyToOne(targetEntity = BJi.class) // 班级
	@JoinColumn(name = "BJi_id", referencedColumnName = "id")
	@Cascade(CascadeType.SAVE_UPDATE)
	private BJi bJi;

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getNum() {
		return num;
	}

	public void setNum(String num) {
		this.num = num;
	}

	public String getSname() {
		return sname;
	}

	public void setSname(String sname) {
		this.sname = sname;
	}

	public String getSex() {
		return sex;
	}

	public void setSex(String sex) {
		this.sex = sex;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getNativeplace() {
		return nativeplace;
	}

	public void setNativeplace(String nativeplace) {
		this.nativeplace = nativeplace;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public Set<BookFee> getBookFees() {
		return bookFees;
	}

	public void setBookFees(Set<BookFee> bookFees) {
		this.bookFees = bookFees;
	}

	public BJi getbJi() {
		return bJi;
	}

	public void setbJi(BJi bJi) {
		this.bJi = bJi;
	}

	public Student() {
		super();
		// TODO Auto-generated constructor stub
	}

}
